//
//  City.m
//  ImGuider
//
//  Created by llt on 2017/4/14.
//  Copyright © 2017年 imguider. All rights reserved.
//

#import "City.h"

@implementation City

+ (NSDictionary *)modelCustomPropertyMapper {
    
    return @{@"cid" : @"id"};
}

+ (NSDictionary *)modelContainerPropertyGenericClass {
    
    return @{@"weather" : [Weather class],@"views" : [Scenic class],@"lines" : [LineModel class]};
}

- (NSArray *)tagsArray {
    NSMutableArray * arr = [NSMutableArray array];
    for (NSString *str in [self.tags componentsSeparatedByString:@","]) {
        if (str.length > 0) {
            [arr insertObject:str atIndex:0];
        }
    }
    return  arr;
}

- (NSString *)smartName {
    
    //    en
    //    zh-Hans-US
    //    zh-Hant-US
    //    zh-Hant-TW
    
//    if ([[AppManager sharedManager].language containsString:@"en"]) {
//        return _ename;
//    } else {
//        return _name;
//    }
    
    NSString *name = @"";
    if ([[AppManager sharedManager].language hasPrefix:@"zh-Hans"]) {
        
        name = _name;
    } else if ([[AppManager sharedManager].language hasPrefix:@"zh-Hant"]) {
        
        name = _fname;
    }else {
        
        name = _ename;
    }
    
    if (name.length == 0) {
        name = _name;
    }
    return name;
}

@end
